Starting the Application
Iquea Commerce consists of two separate servers that must run simultaneously:- Backend API (Spring Boot on port 8080)
- Frontend UI (Vite dev server on port 5173)
You’ll need two terminal windows open - one for the backend and one for the frontend.
Running the Backend
Start the Spring Boot Server
Run the application using Maven Wrapper:
First startup may take 30-60 seconds as Hibernate creates database tables and loads initial data from
data.sql.Running the Frontend
Accessing the Application
Application URLs
| Service | URL | Description |
|---|---|---|
| Frontend (UI) | http://localhost:5173 | React application (Vite dev server) |
| Backend (API) | http://localhost:8080 | Spring Boot REST API |
| API Endpoints | http://localhost:8080/api/* | RESTful API resources |
Test User Accounts
The application comes with pre-configured test accounts loaded fromdata.sql:
Admin Account
Username:
Password:
Permissions: Full product and category management
adminPassword:
password123Permissions: Full product and category management
Customer Account 1
Username:
Password:
Permissions: Browse products, place orders
maria123Password:
password123Permissions: Browse products, place orders
Customer Account 2
Username:
Password:
Permissions: Browse products, place orders
carlos99Password:
password123Permissions: Browse products, place orders
Login credentials are case-sensitive. Make sure to use lowercase usernames.
Testing the Application
1. Browse Products (No Authentication Required)
- Visit http://localhost:5173
- Browse the product catalog organized by categories
- Use the search functionality
- View product details
2. Login as Customer
- Click the Login button
- Enter credentials:
- Username:
maria123 - Password:
password123
- Username:
- You can now:
- Add products to cart
- Place orders
- View order history
3. Login as Admin
- Log out if currently logged in
- Login with admin credentials:
- Username:
admin - Password:
password123
- Username:
- You can now:
- Create new products
- Edit existing products
- Delete products
- Manage categories
4. Test API Endpoints
Stopping the Application
Stop Backend (Spring Boot)
In the backend terminal, press:Stop Frontend (Vite)
In the frontend terminal, press:Troubleshooting Startup Issues
Backend Issues
Error: “Port 8080 already in use”
Problem: Another application is using port 8080. Solution 1: Stop the conflicting process:application.properties:
Error: “Access denied for user ‘root’@‘localhost’”
Problem: Database credentials are incorrect or user doesn’t have permissions. Solutions:-
Verify MySQL is running:
-
Test database connection:
-
Update credentials using environment variables:
-
Grant database permissions:
Error: “Table ‘apiIquea.producto’ doesn’t exist”
Problem: Database schema wasn’t created automatically. Solutions:-
Verify
application.propertiessetting: -
Check database URL includes createDatabaseIfNotExist:
-
Manually create database:
- Restart the backend to trigger schema creation.
Error: “Failed to load initial data from data.sql”
Problem: Data initialization script failed, often due to constraint violations or existing data. Solutions:-
Drop and recreate database:
-
Temporarily change ddl-auto to create:
Frontend Issues
Error: “Port 5173 already in use”
Problem: Another Vite dev server or application is using port 5173. Solution 1: Kill the process:Error: “Failed to fetch” or “Network Error”
Problem: Frontend can’t connect to backend API. Solutions:-
Verify backend is running:
-
Check CORS configuration in
SecurityConfig.java: - Clear browser cache and cookies (Ctrl+Shift+Delete)
- Check browser console for specific error messages (F12)
Error: “Module not found” or “Cannot find module”
Problem: Node dependencies are missing or corrupted. Solutions:-
Reinstall dependencies:
-
Clear npm cache:
Authentication Issues
Problem: “Invalid credentials” when logging in
Solutions:-
Verify initial data was loaded:
-
Check passwords are hashed with BCrypt (they should start with
$2a$or$2b$) - Ensure usernames are lowercase
-
Re-run data.sql manually if users are missing:
Problem: JWT token expires immediately
Solution: CheckJwtUtil.java expiration setting:
Development Tips
Hot Reload
- Backend: Spring Boot DevTools enables automatic restart on code changes. Just save your Java files and the server will restart.
- Frontend: Vite provides instant Hot Module Replacement (HMR). Changes to React components appear immediately without full page reload.
Viewing Logs
Backend logs: All SQL statements and Spring Boot logs appear in the terminal where you ranmvnw spring-boot:run.
Frontend logs: Use browser DevTools (F12) to view console logs, network requests, and errors.
Database Inspection
Option 1: MySQL Workbench (GUI) Connect tolocalhost:3306 and browse the apiIquea database.
Option 2: Command Line
Next Steps
Now that your application is running:- Explore the API Reference to learn about available endpoints
- Read the Architecture Overview to understand the system design
- Check out the Development Guide for contribution guidelines
For production deployment, refer to the Deployment Guide (coming soon) for instructions on building production bundles and deploying to cloud platforms.